While a popover is hiding, the modal grab is already gone and the toggle
button is clickable again, but clicking again at that time will result in
gtk_widget_show() trying to show an already shown widget (although fading
out and hidden soon) and the toggle button activated.
So let the menubutton set the active status only if the menu/popover
widget wasn't already shown, and ensure this doesn't get triggered by
double/triple button press events.
if (event->button == GDK_BUTTON_PRIMARY)
{
- if (priv->menu)
+ /* Filter out double/triple clicks */
+ if (event->type != GDK_BUTTON_PRESS)
+ return TRUE;
+
+ if (priv->menu && !gtk_widget_get_visible (priv->menu))
popup_menu (menu_button, event);
- else if (priv->popover)
+ else if (priv->popover && !gtk_widget_get_visible (priv->popover))
gtk_widget_show (priv->popover);
+ else
+ return TRUE;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);